/*
 * @Author: szx
 * @Date: 2021-12-06 13:57:55
 * @LastEditTime: 2021-12-06 14:00:33
 * @Description:
 * @FilePath: \leetcode\300-399\349\349.js
 */
/**
 * @param {number[]} nums1
 * @param {number[]} nums2
 * @return {number[]}
 */
var intersection = function (nums1, nums2) {
    const set1 = new Set(nums1);
    const res = new Set();
    for (let i of nums2) {
        if (set1.has(i)) {
            res.add(i);
        }
    }
    return Array.from(res);
};
